package com.android.stockme.backend.configuration;

import java.util.Collection;


public interface IConfigurationManager {

	
	/**
	 * Add a new stock to the database.
	 * Update the database and save the new settings in configuration file.
	 * The method will also post, to its listeners, an event about the change 
	 * @param symbol -
	 * 			stock's {@code String} symbol represents the new stock to add
	 * @return
	 */	
	public abstract void addStock(String symbol);
	
		


	/**
	 * Remove a stock from the database.
	 * Update the database and save the new settings in configuration file.
	 * The method will also post, to its listeners, an event about the change 
	 * @param symbol -
	 * 			stock's {@code String} symbol represents the stock to be removed
	 * @return
	 */	
	public abstract void removeStock(String symbol);
	
	
		
	
	/**
	 * Set new tick frequency for stocks data update
	 * Update the database and save the new settings in configuration file.
	 * The method will also post, to its listeners, an event about the change 
	 * @param seconds -
	 * 			new frequency in seconds
	 * @return
	 */	
	public abstract void setStockTickFrequency(int seconds);
	
	
		
	

	/**
	 * Set new tick frequency for news data update
	 * Update the database and save the new settings in configuration file.
	 * The method will also post, to its listeners, an event about the change 
	 * @param seconds -
	 * 			new frequency in seconds
	 * @return
	 */	
	public abstract void setNewsTickFrequency(int seconds);
	
	
		


	/**
	 * Set new news maximum history length
	 * Update the database and save the new settings in configuration file.
	 * The method will also post, to its listeners, an event about the change 
	 * @param length -
	 * 			new maximum history length
	 * @return
	 */	
	public abstract void setNewsHistoryLength(int length);
	
	
		


	/**
	 * Get the news maximum history length
	 * @param
	 * @return returns news maximum history length as {@code int}
	 */	
	public abstract int getStockTickFrequency();
	
	
		


	/**
	 * Get the tick frequency for news data update
	 * @param
	 * @return returns tick frequency for news data update as {@code int}
	 */	
	public abstract int getNewsTickFrequency();
	
	
		


	/**
	 * Get the news maximum history length
	 * @param
	 * @return returns news maximum history length as {@code int}
	 */	
	public abstract int getNewsHistoryLength();
	
	
		


	/**
	 * Add new listener for "added stock" event
	 * @param listener -
	 * 			 listener to be added for "added stock" event
	 * @return
	 */	
	public abstract void registerStockAddedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Remove listener for "added stock" event
	 * @param listener -
	 * 			 listener to be removed for "added stock" event
	 * @return
	 */	
	public abstract void unregisterStockAddedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Add new listener for "remove stock" event
	 * @param listener -
	 * 			 listener to be added for "remove stock" event
	 * @return
	 */	
	public abstract void registerStockRemovedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Remove listener for "remove stock" event
	 * @param listener -
	 * 			 listener to be removed for "remove stock" event
	 * @return
	 */	
	public abstract void unregisterStockRemovedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Add new listener for "history length changed" event
	 * @param listener -
	 * 			 listener to be added for "history length changed" event
	 * @return
	 */	
	public abstract void registerHistoryLengthChangedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Remove listener for "history length changed" event
	 * @param listener -
	 * 			 listener to be removed for "history length changed" event
	 * @return
	 */	
	public abstract void unregisterHistoryLengthChangedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Add new listener for "stock tick frequency changed" event
	 * @param listener -
	 * 			 listener to be added for "stock tick frequency changed" event
	 * @return
	 */	
	public abstract void registerStockTickFrequencyChangedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Remove listener for "stock tick frequency changed" event
	 * @param listener -
	 * 			 listener to be removed for "stock tick frequency changed" event
	 * @return
	 */	
	public abstract void unregisterStockTickFrequencyChangedListener(IConfigurationChangedListener listener);
	
	
		


	/**
	 * Add new listener for "news tick frequency changed" event
	 * @param listener -
	 * 			 listener to be added for "news tick frequency changed" event
	 * @return
	 */	
	public abstract void registerNewsTickFrequencyChangedListener(IConfigurationChangedListener listener);
	
	
		
	
	/**
	 * Remove listener for "news tick frequency changed" event
	 * @param listener -
	 * 			 listener to be removed for "news tick frequency changed" event
	 * @return
	 */	
	public abstract void unregisterNewsTickFrequencyChangedListener(IConfigurationChangedListener listener);
	
	
		
	/**
	 * Add new listener for "finance web site changed" event
	 * @param listener -
	 * 			 listener to be added for "finance web site changed" event
	 * @return
	 */	
	public abstract void registerFinanceWebsiteChangedListener(IConfigurationChangedListener listener);
	
	
		
	
	/**
	 * Remove listener for "finance web site changed" event
	 * @param listener -
	 * 			 listener to be removed for "finance web site changed" event
	 * @return
	 */	
	public abstract void unregisterFinanceWebsiteChangedListener(IConfigurationChangedListener listener);
	
	
	
	
	/**
	 * Set new finance web site from which data about stock will be retrieved
	 * Update the database and save the new settings in configuration file.
	 * The method will also post, to its listeners, an event about the change 
	 * @param siteDatabaseName -
	 * 			data base site {@code String} represents the new web site from which fetch stocks data
	 * @return
	 */	
	public abstract void setFinanceWebsite(String siteDatabaseName);
	
	
	
		

	/**
	 * Get the current finance web site from which data about stocks is fetched
	 * @param
	 * @return returns {@code String} represents the current finance web site
	 */	
	public abstract String getFinanceWebsite();
	
	
	
	
	
	/**
	 * Get all finance web sites from which data about stocks can be fetched
	 * @param
	 * @return returns {@code String} array represents finance web sites the system supports
	 */	
	public abstract String[] getDataBaseFinanceWebSites();
	
	
	
	
	
	/**
	 * Determine if a stock symbol already exists in the data base
	 * @param symbol - 
	 * 				stock's {@code String} symbol
	 * @return {@code true} if stock symbol exists in the data base, {@code false}
	 * otherwise
	 */	
	public abstract boolean doesStockExists(String symbol);
	
		
	
	
	
	
    /**
     * Return the status of high bound check box, for a specific stock
	 * @param symbol - 
	 * 				stock's {@code String} symbol
     * @return {@code true} if high bound check box is marked, {@code false}
     *         otherwise
     */
	public abstract boolean isHighBoundConfigured(String symbol);
	
	
		


    /**
     * Return the status of low bound check box, for a specific stock
	 * @param symbol - 
	 * 				stock's {@code String} symbol
     * @return {@code true} if low bound check box is marked, {@code false}
     *         otherwise
     */
	public abstract boolean isLowBoundConfigured(String symbol);
	
	


	
    /**
     * Return the high bound that was set by the user, for a specific stock
     * At beginning the value is 0.0
	 * @param symbol - 
	 * 				stock's {@code String} symbol
     * @return {@code float} value of the high bound
     */
	public abstract float getHighBound(String symbol);
	
	
		


    /**
     * Return the low bound that was set by the user, for a specific stock
     * At beginning the value is 0.0
	 * @param symbol - 
	 * 				stock's {@code String} symbol
     * @return {@code float} value of the low bound
     */
	public abstract float getLowBound(String symbol);
	
	
		


    /**
     * For a specific stock, set the high bound to be {@code high}
	 * @param symbol - 
	 * 				stock's {@code String} symbol
	 * @param high -
     * 			the new high bound to be set
     * @return
     */
	public abstract void setHighBound(String symbol, float high);
			
	
			


	
    /**
     * For a specific stock, set the low bound to be {@code high}
     * @param symbol - 
	 * 			stock's {@code String} symbol
     * @param low -
     * 			the new low bound to be set
     * @return
     */
	public abstract void setLowBound(String symbol, float low);
	
	
	
	/**
	 * Restore the default values of finance website , 
	 * news history length , news tick frequency and stock tick frequency
	 * @param
	 * @return
	 */	
	public abstract void restoreDefault();
	
	
	
	
    /**
     * Set new {@code boolean} low bound check box status, for a specific stock
     * @param symbol - 
	 * 			stock's {@code String} symbol
     * @param bool -
     * 			the new low bound status
     * @return
     */
	public abstract void setLowEnableDisable(String symbol, boolean bool);

		
	
	
    /**
     * Set new {@code boolean} high bound check box status, for a specific stock
     * @param symbol - 
	 * 			stock's {@code String} symbol
     * @param bool -
     * 			the new high bound status
     * @return
     */
	public abstract void setHighEnableDisable(String symbol, boolean bool);


	
	
	/**
	 * Get the symbols of all stocks in the data base
	 * @param
	 * @return returns the symbols of all stocks in the data base as {@code Collection<String>}
	 */	
	public abstract Collection<String> getStockSymbols();
	
	
	
	
	/**
	 * Get the current notification state which determines if the alarm is Enabled or Disabled
	 * @param
	 * @return returns the notification state as {@code boolean}
	 */	
	public abstract boolean getNotificationState();
	
	
	
	
    /**
     * Set new notification state which will determine if the alarm is Enabled or Disabled
     * @param state - 
	 * 			new notification state. {@code true} will Enable the alarm, otherwise the alarm will be disabled
     * @return
     */
	public abstract void setNotificationState(boolean state);
	
}
